package com.wft.singleton;

public class Test02Synchronized {
    private static volatile Test02Synchronized instance;

    private Test02Synchronized() {
    }

    public static synchronized Test02Synchronized getInstance() {
        if (instance == null) {
            instance = new Test02Synchronized();
        }
        return instance;
    }

    public static void main(String[] args) throws IllegalAccessException, InstantiationException {
        System.out.println(Test02Synchronized.getInstance());
        System.out.println(Test02Synchronized.getInstance());


        Test02Synchronized doubleCheck = Test02Synchronized.class.newInstance();
        System.out.println(doubleCheck);
    }
}
